class MyDict(dict):
    def __new__(cls):
        print("__new__ function in MyDict")
        return super(MyDict, cls).__new__(cls)

# md=MyDict()


class MyMetaClass(type):
    counter = 0
    def __new__(cls, name, bases, attrs):
        print("__new__ function in MyMetaClass",f"{name}")
        # return super().__new__(cls, name, bases, attrs)
        cls.counter += 1
        if cls.counter > 10:
            print("Too many classes")
            raise Exception("Too many classes")
        attrs["my_attrs"]= {"counter":cls.counter}
        return type.__new__(cls, name, bases, attrs)
    

# mb=MyMetaClass('dd',(),{"name":"Jobs"})
# print(hasattr(mb,"name"))
# print(mb.counter)


class MyBaseClass(MyDict, metaclass=MyMetaClass):
    info = "I am base class"

myDict = MyDict()
myBase = MyBaseClass()
print(myBase.info)
print(myBase.__dir__())
print(myDict.__dir__())





